<?php
/**
 * ケイノスのメール送信関数
 *
 */
if(!function_exists('KEINOS_mail')){
    function KEINOS_mail($aData){

        mb_substitute_character("long");
        mb_internal_encoding("SJIS-win"); //メール処理用に内部エンコードをUTF-8からSJISに変換
        mb_convert_variables("SJIS-win",auto,$aData); //メール用にUTF-8からSJISに変換。
        mb_http_output('SJIS-win');

        $aData['toName']   = mb_encode_mimeheader($aData['toName']); //ISO-2022-JP
        $aData['fromName'] = mb_encode_mimeheader($aData['fromName']); //ISO-2022-JP

        $sTo      = "{$aData['toName']} <{$aData['to']}>";
        $sSubject = $aData['subject'];
        $sBody    = $aData['body'];
        $sFrom    = "from: {$aData['fromName']} <{$aData['from']}>\n";

        $bResult  = (mb_send_mail($sTo,$sSubject,$sBody,$sFrom)) ? "OK" : "NG";

        utf_8();
        return $bResult;
    }
}

?>